import 'dart:convert';

class MyCollectionModel {
  int? collectionId;
  String? collectionName;
  String? collectionThumbnailImageUrl;
  int? collectionAuthorId;
  String? collectionAuthorName;
  String? collectionAuthorProfilePhotoUrl;
  int? collectionCount;

  MyCollectionModel(
      {this.collectionId,
      this.collectionName,
      this.collectionThumbnailImageUrl,
      this.collectionAuthorId,
      this.collectionAuthorName,
      this.collectionAuthorProfilePhotoUrl,
      this.collectionCount});

  MyCollectionModel.fromJson(Map<String, dynamic> json) {
    if (json["collectionId"] is int) {
      collectionId = json["collectionId"];
    }
    if (json["collectionName"] is String) {
      collectionName = json["collectionName"];
    }
    if (json["collectionThumbnailImageUrl"] is String) {
      collectionThumbnailImageUrl = json["collectionThumbnailImageUrl"];
    }
    if (json["collectionAuthorId"] is int) {
      collectionAuthorId = json["collectionAuthorId"];
    }
    if (json["collectionAuthorName"] is String) {
      collectionAuthorName = json["collectionAuthorName"];
    }
    if (json["collectionAuthorProfilePhotoUrl"] is String) {
      collectionAuthorProfilePhotoUrl = json["collectionAuthorProfilePhotoUrl"];
    }
    if (json["collectionCount"] is int) {
      collectionCount = json["collectionCount"];
    }
  }

  static List<MyCollectionModel> fromList(List<Map<String, dynamic>> list) {
    return list.map(MyCollectionModel.fromJson).toList();
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data["collectionId"] = collectionId;
    data["collectionName"] = collectionName;
    data["collectionThumbnailImageUrl"] = collectionThumbnailImageUrl;
    data["collectionAuthorId"] = collectionAuthorId;
    data["collectionAuthorName"] = collectionAuthorName;
    data["collectionAuthorProfilePhotoUrl"] = collectionAuthorProfilePhotoUrl;
    data["collectionCount"] = collectionCount;
    return data;
  }

  @override
  String toString() {
    return jsonEncode(this);
  }
}
